﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.Linq;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using DataAccessLayer;

namespace Medical_Equipments
{
    public partial class Form1 : Form
    {
        public MedicalEquipmentsDataContext dataContext
        {
            get { return MedicalEquipmentsDataContext.GetMedicalEquipmentsDataContext(ConfigurationManager.ConnectionStrings["embedded_db"].ConnectionString); }
        }

        public Form1()
        {
            InitializeComponent();
            if (dataContext != null)
            {
                DocumentNames dn = new DocumentNames();
                dn.name = "Наряд";
                dataContext.DocumentNames.InsertOnSubmit(dn);
                dataContext.SubmitChanges();



                List<string> l = dataContext.DocumentNames.Select(x => x.name).ToList();
                int count = l.Count;
                dataContext.Dispose();
                MessageBox.Show(count.ToString());
            }
        }
    }
}
